feat(schema): show functions and procedures in the object tree#36
Merged
Conversation
Follow-up to the materialized-views work (#27) and a support request: routines defined in a schema were not shown in the tree, though the backend already lists them. Add Functions and Procedures groups under each schema, mirroring the Tables/Views/Materialized-views pattern, with a definition view on select. Functions/procedures are overloadable (same name, different arg signatures) and the definition fetch needs the exact args, so routine leaf node keys encode the signature: function:<schema>/<name>#<encodedArgs>. A shared routineKey/ parseRoutineKey codec keeps the store (key builder) and ObjectDetails (decoder) in lockstep, and percent-encoding the args keeps them clear of the key delimiters. Two groups (not one merged Routines group) because the backend exposes two distinct list/definition commands with asymmetric DTOs. Fixes #33 Signed-off-by: exzvor <exzvor@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to materialized views (#27) and a support request: functions and procedures defined in a schema weren't shown in the object tree, though the backend already lists them. Adds Functions and Procedures groups under each schema (mirroring Tables / Views / Materialized views), with a definition view on selection.
Routines are overloadable (same name, different arg signatures) and the definition fetch needs the exact args, so routine leaf keys encode the signature:
function:<schema>/<name>#<encodedArgs>. A sharedroutineKey/parseRoutineKeycodec keeps the store (key builder) andObjectDetails(decoder) in lockstep; percent-encoding the args keeps them clear of the/and#delimiters. Two groups rather than one merged "Routines" group, because the backend exposes two distinct list/definition commands with asymmetric DTOs.Related issue
Fixes #33
Tests
store.test.ts: a schema now expands to five synthetic groups (tables/views/matviews/functions/procedures) with no backend call;/functionsand/proceduresmap to leaf nodes (assertingschemaListFunctions(conn,'public',false)/schemaListProcedures); overloads produce distinct keys;routineKey↔parseRoutineKeyround-trips args with commas/spaces/brackets and empty args. Existing SchemaTree/ObjectDetails/Browser suites stay green (85 total).Self-verification
npm run typecheck/npm run lintcleannpm run testgreen (schema feature: 85)schema_list_functions/schema_list_procedures/ definitions already existedNotes for reviewer
RoutineDetailsis one component for both function and procedure (renders signature + language + body; the union's common fields only, no per-kind narrowing). Routines are selectable leaves (no expand caret); not added to the actionable context menu (no routine editor yet) — that can be a follow-up.